package org.witsoft.localmq.model;

import lombok.Data;

/**
 * @ClassName: Segment
 * @Description:
 * @Author: Colin
 * @Date: 2020/12/26 11:24 AM
 * @Version 1.0
 **/
@Data

public class Segment {

    private int id;

    private long startOffset;

    private int position;

    private long fileSize;

    public long getEndOffset(){
        return this.startOffset + position;
    }


    protected Segment clone()  {
        Segment newObj = new Segment();
        newObj.id = this.id;
        newObj.startOffset = this.startOffset;
        newObj.position = this.position;
        newObj.fileSize = this.fileSize;
        return newObj;
    }
}
